﻿// Project: EnumDataSourceControl, File: EnumTypeInfo.cs
// Namespace: Salient.Web.UI.WebControls, Class: EnumTypeInfo
// Author: Sky Sanders (sky.sanders@gmail.com)

// Creation date: 10/15/2008 8:24 PM
// Last modified: 10/16/2008 7:20 AM


#region Using directives
using System;
using System.Collections.Generic;
#endregion


/// <summary>
/// Salient. web. UI. web controls
/// </summary>
namespace Salient.Web.UI.WebControls
{
    /// <summary>
    /// 
    /// </summary>
    public class EnumTypeInfo
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="enumType"></param>
        public EnumTypeInfo(Type enumType)
        {
            Name = enumType.Name;
            FullName = enumType.FullName;

            Values = new List<EnumValueInfo>();

            foreach (Enum value in Enum.GetValues(enumType))
            {

                Values.Add(new EnumValueInfo()
                {
                    EnumValue = value,
                    IntegralValue = Salient.Util.EnumExtensions.GetTypedValue(value),
                    Name = value.ToString(),
                    Description = Salient.Util.EnumExtensions.GetDescription(value)
                });
            } // foreach  (value)
        } // EnumTypeInfo(enumType)

        /// <summary>
        /// Full name
        /// </summary>
        /// <returns>String</returns>
        public string FullName { get; set; } // FullName

        /// <summary>
        /// Name
        /// </summary>
        /// <returns>String</returns>
        public string Name { get; set; } // Name

        /// <summary>
        /// Values
        /// </summary>
        /// <returns>List</returns>
        public List<EnumValueInfo> Values { get; private set; } // Values

    } // class EnumTypeInfo
} // namespace Salient.Web.UI.WebControls
